package com.mineoj.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mineoj.model.dto.news.NewsAddRequest;
import com.mineoj.model.dto.news.NewsQueryRequest;
import com.mineoj.model.entity.News;
import com.baomidou.mybatisplus.extension.service.IService;
import com.mineoj.model.entity.News;
import com.mineoj.model.entity.User;
import com.mineoj.model.vo.NewsVO;

import javax.servlet.http.HttpServletRequest;

/**
* @author 明月
* @description 针对表【news(新鲜事)】的数据库操作Service
* @createDate 2025-04-11 19:39:27
*/
public interface NewsService extends IService<News> {

    /**
     * 校验
     *
     * @param news
     * @param add
     */
    void validNews(News news, boolean add);


    /**
     * 获取查询条件
     *
     * @param newsQueryRequest
     * @return
     */
    QueryWrapper<News> getQueryWrapper(NewsQueryRequest newsQueryRequest);


    /**
     * 获取新鲜事封装
     *
     * @param news
     * @param request
     * @return
     */
    NewsVO getNewsVO(News news, HttpServletRequest request);

    /**
     * 分页获取帖子封装
     *
     * @param newsPage
     * @param request
     * @return
     */
    Page<NewsVO> getNewsVOPage(Page<News> newsPage, HttpServletRequest request);


    /**
     * 删除帖子
     * @param id
     * @return
     */
    boolean deleteById(long id);
}
